/**
 * Created by Afee Lee on 2017-03-26.
 */

function getToken() {
    var username = $('#username').val();
    var password = $('#password').val();
    var tokenPanel = $('#token');

    $.ajax({
        url: "../auth/password",
        type: "post",
        cache: false,
        data: {'username': username, 'password': password},
        dataType: "json",

        beforeSend: function () {
            tokenPanel.html('');
        },
        success: function (d) {
            tokenPanel.html(JSON.stringify(d));
        },
        error: function (r, textStatus, errorThrown) {
            tokenPanel.html(textStatus);
        }
    });
}